home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Amiga_Mail_Vol2 / Archives / Plain / mj91 / ASL / FontReq.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-12  |  3.3 KB  |  113 lines

  1. ;/* fontreq.c - Execute me to compile me with Lattice 5.10
  2. LC -b1 -cfistq -v -y -j73 fontreq.c
  3. Blink FROM LIB:c.o,fontreq.o TO fontreq LIBRARY LIB:LC.lib,LIB:Amiga.lib
  4. quit
  5. */
  6.  
  7. /*(c)  Copyright 1991 Commodore-Amiga, Inc.   All rights reserved.
  8. The information contained herein is subject to change without notice,
  9. and is provided "as is" without warranty of any kind, either expressed
  10. or implied.  The entire risk as to the use of this information is
  11. assumed by the user.
  12. */
  13.  
  14.  
  15. #include <clib/asl_protos.h>
  16. #include <clib/exec_protos.h>
  17. #include <clib/alib_stdio_protos.h>
  18. #include <exec/libraries.h>
  19.  
  20. #ifdef LATTICE
  21. int CXBRK(void) { return(0); }  /* Disable Lattice CTRL/C handling */
  22. int chkabort(void) { return(0); }  /* really */
  23. #endif
  24.  
  25.  
  26. UBYTE *vers = "\0$VER: fontreq 1.0";
  27.  
  28. void main(void);
  29. struct Library *AslBase, *UtilityBase;
  30.  
  31. /* The replacement strings for the "mode" cycle gadget.  The
  32. ** first string is the cycle gadget's label.  The other strings
  33. ** are the actual strings that will appear on the cycle gadget.
  34. */
  35. UBYTE *modelist[] = 
  36. {
  37.     "RKM Modes",
  38.     "Mode 0",
  39.     "Mode 1",
  40.     "Mode 2",
  41.     "Mode 3",
  42.     "Mode 4",
  43.     "Mode 5",
  44.     "Mode 6",
  45.     "Mode 7",
  46.     "Mode 8",
  47.     "Mode 9",
  48.     NULL
  49. };
  50.     
  51.  
  52. void main()
  53. {
  54.  
  55.     struct FontRequester *fr;
  56.  
  57.     if (AslBase = OpenLibrary("asl.library", 36L))
  58.     {
  59.  
  60.         if (fr = (struct FontRequester *)
  61.             AllocAslRequestTags(ASL_FontRequest, 
  62.                 /* tell the requester to use my custom mode names */
  63.                 ASL_ModeList, modelist,
  64.                 
  65.                 /* Supply initial values for requester */
  66.                 ASL_FontName, (ULONG)"topaz.font",
  67.                 ASL_FontHeight, 11L,
  68.                 ASL_FontStyles, FSF_BOLD | FSF_ITALIC,
  69.                 ASL_FrontPen,  0x00L,
  70.                 ASL_BackPen,   0x01L,
  71.                 
  72.                 /* Only display font sizes between 8 and
  73.                 ** 14, inclusive. */
  74.                 ASL_MinHeight, 8L,
  75.                 ASL_MaxHeight, 14L,
  76.                 
  77.                 /* Give us all the gadgetry, but only display
  78.                 ** fixed width fonts */
  79.                 ASL_FuncFlags, FONF_FRONTCOLOR | FONF_BACKCOLOR | 
  80.                     FONF_DRAWMODE | FONF_STYLES | FONF_FIXEDWIDTH,
  81.                 TAG_DONE))
  82.         {
  83.             /* application code here... */
  84.             
  85.             
  86.             /* Pop up the requester */
  87.             if (AslRequest(fr, 0L))
  88.             {
  89.                 /* The user selected something,  report their choice */
  90.                 printf("%s\n  YSize = %d  Style = 0x%x   Flags = 0x%x\n"
  91.                        "  FPen = 0x%x   BPen = 0x%x   DrawMode = 0x%x\n", 
  92.                                fr->fo_Attr.ta_Name,
  93.                                fr->fo_Attr.ta_YSize, 
  94.                                fr->fo_Attr.ta_Style,
  95.                                fr->fo_Attr.ta_Flags,
  96.                                fr->fo_FrontPen,
  97.                                fr->fo_BackPen,
  98.                                fr->fo_DrawMode);
  99.             }
  100.             else
  101.                 /* The user cancelled the requester, or
  102.                 ** some kind of error occured preventing
  103.                 ** the requester from opening. */
  104.                 printf("Request Cancelled\n");
  105.  
  106.             /* more application code here ...*/
  107.             
  108.             FreeAslRequest(fr);
  109.         }
  110.         CloseLibrary(AslBase);
  111.     }
  112. }
  113.